home *** CD-ROM | disk | FTP | other *** search
- class Heroes.Box
- {
- var x;
- var y;
- var z;
- var w;
- var h;
- var b;
- function Box(x, y, z, w, h, b)
- {
- this.setLocation(x,y,z);
- this.setSize(w,h,b);
- }
- function setLocation(x, y, z)
- {
- this.x = x;
- this.y = y;
- this.z = z;
- }
- function setSize(w, h, b)
- {
- this.w = w;
- this.h = h;
- this.b = b;
- }
- function isHitting(myBox)
- {
- var _loc3_ = 0;
- if(myBox.x < this.x + this.w)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(myBox.x + myBox.w > this.x)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(myBox.y + myBox.h > this.y)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(myBox.y < this.y + this.h)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(myBox.z + myBox.b > this.z)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(myBox.z < this.z + this.b)
- {
- _loc3_ = _loc3_ + 1;
- }
- if(_loc3_ == 6)
- {
- return true;
- }
- return false;
- }
- function isTouching(px, py, pz)
- {
- if(px < this.x + this.w)
- {
- if(px > this.x)
- {
- if(py > this.y)
- {
- if(py < this.y + this.h)
- {
- if(pz > this.z)
- {
- if(pz < this.z + this.b)
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- function toString()
- {
- return Math.round(this.w) + "*" + Math.round(this.h) + "*" + Math.round(this.b) + " @ (" + Math.round(this.x) + "," + Math.round(this.y) + "," + Math.round(this.z) + ")";
- }
- }
-